/**
 * Copyright (c) 2022 Beijing Jiaotong University
 * PhotLab is licensed under [Open Source License].
 * You can use this software according to the terms and conditions of the [Open Source License].
 * You may obtain a copy of [Open Source License] at: [https://open.source.license/]
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 *
 * See the [Open Source License] for more details.
 *
 * Author: Qing'ao Zhang, Zhenjie Wei
 * Created: Mar. 15, 2023
 * Supported by: National Key Research and Development Program of China
 */

/* eslint-disable @typescript-eslint/no-explicit-any */

import thriftClient from "../utils/conn"
import service from "../thrift/gen-nodejs/Main"

export default class RemoteService {
    private _client: any
    constructor(socket: [string, number]) {
        this._client = thriftClient(service, socket[0], socket[1])
    }

    public async getServerVersion() {
        return await this._client.get_server_version()
    }
    public async getServerVariables() {
        return await this._client.get_server_variables()
    }
    public async getServerVariable(variable: string, value: string) {
        return await this._client.set_server_variable(variable, value)
    }
    public async getServerLog(maxLogNum: string, logger: string) {
        return await this._client.get_server_log(maxLogNum, logger)
    }
}
